Skip to content

xds: make it possible to create a StringMatcher from arguments outside of test code#8723

Merged
easwars merged 3 commits intogrpc:masterfrom
easwars:string_matcher
Nov 26, 2025
Merged

xds: make it possible to create a StringMatcher from arguments outside of test code#8723
easwars merged 3 commits intogrpc:masterfrom
easwars:string_matcher

Conversation

@easwars
Copy link
Copy Markdown
Contributor

@easwars easwars commented Nov 21, 2025

Changes in this PR:

  • Add a new constructors for StringMatcher that can be shared between test and non-test code. This will be used as part of an internal feature to support ext_authz.
  • Create new pointers to match strings instead of using the ones from the proto. This would ensure that the xDS proto structs (which are usually huge) can be garbage collected earlier that currently.
  • Fixes a bug involving the regex matcher, which should not be considering the ignore_case field, but was.

RELEASE NOTES:

  • xds: Fix a bug in StringMatcher where regexes would match incorrectly when ignore_case is set to true.

@easwars easwars requested review from arjan-bal and Copilot November 21, 2025 07:07
@easwars easwars added Area: xDS Includes everything xDS related, including LB policies used with xDS. Type: Bug labels Nov 21, 2025
@easwars easwars added this to the 1.78 Release milestone Nov 21, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 95.12195% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.18%. Comparing base (50c6321) to head (319b300).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
internal/xds/matcher/string_matcher.go 95.12% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8723      +/-   ##
==========================================
- Coverage   83.21%   83.18%   -0.03%     
==========================================
  Files         419      419              
  Lines       32427    32450      +23     
==========================================
+ Hits        26985    26995      +10     
- Misses       4054     4064      +10     
- Partials     1388     1391       +3     
Files with missing lines Coverage Δ
internal/xds/matcher/string_matcher.go 91.17% <95.12%> (-1.46%) ⬇️

... and 19 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This comment was marked as outdated.

Comment thread internal/xds/matcher/string_matcher.go Outdated
@arjan-bal arjan-bal assigned easwars and unassigned arjan-bal Nov 25, 2025
@easwars easwars requested a review from arjan-bal November 25, 2025 19:13
@easwars easwars assigned arjan-bal and unassigned easwars Nov 25, 2025
Copy link
Copy Markdown
Contributor

@arjan-bal arjan-bal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

matcher.StringMatcherForTesting(nil, nil, nil, newStringP("2001:db8:1:1::68"), nil, false),
matcher.StringMatcherForTesting(nil, nil, nil, newStringP("GRPC"), nil, false),
matcher.NewContainsStringMatcher("i-aint-the-one", false),
matcher.NewContainsStringMatcher("2001::db8:1:1::68", false),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The double colon in 2001:: makes the IPv6 invalid. It doesn't effect the test, but seems like an unintended change which can be reverted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Looks like a copy paste mistake.

@arjan-bal arjan-bal assigned easwars and unassigned arjan-bal Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: xDS Includes everything xDS related, including LB policies used with xDS. Type: Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants